home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17762 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  47 lines

  1. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
  2. From: grantp@usa.pipeline.com(Pete Grant)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Problems passing Device Context handels from VB 4.0 to VC++2.0 DLLÆs
  5. Date: 17 Apr 1996 11:21:58 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4l2k8m$f35@news1.h1.usa.pipeline.com>
  8. References: <4l2bbd$mto@gidora.kralizec.net.au>
  9. NNTP-Posting-Host: 38.8.120.10
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete Grant)
  13. X-Newsreader: Pipeline v3.5.0
  14.  
  15. On Apr 17, 1996 07:49:27 in article <Problems passing Device Context
  16. handels from VB 4.0 to VC++2.0 DLLÆs>, 'srsawyer@zeta.org.au (Stephen
  17. Sawyer)' wrote: 
  18.  
  19.  
  20. >If anyone has has any experiance in writing VC++ DLLs and passing 
  21. >Device Context handels from VB 4.0, I would realy appresiate your 
  22. >help.   I am trying to sent a Device Context handel  from VB 4.0 to a 
  23. >VC++ 2.0 custom DLL but as you can see from my debugger watch values, 
  24. >I do not receive a proper Device Context (hDC) in my VC++ DLL and the 
  25. >result is my DLL crashes.  However I can call the same DLL from a test 
  26. >program in VC++ and it works correctly. 
  27. >My VB calling procedure declaration is of the form  
  28. >    Declare Function MyPassHDC Lib "MyDll.dll" (ByVal hdc As Long) As 
  29. >Integer 
  30. >and my C++ receiving declaration is 
  31. >     
  32. >    int pascal MyPassHDC(CDC* hDC) 
  33.                            ^^^^^^^^^^^ 
  34. CDC is a C++ class. You are telling the compiler that 
  35. you are passing a pointer to a C++ class instance, which 
  36. is not true.  If you want to pass a device context handle, 
  37. then declare it as MyPassHDC(HDC hDC); 
  38.  
  39. [... rest of code/debugger output deleted ...] 
  40. -- 
  41. Pete Grant 
  42. Kalevi, Inc. 
  43. Software Engineering & development
  44.